/*----------------------------------------------------------------------------*/
/* Mark Liu + Jacob Cole (2 lines...)
/* Control_Drive.java
/* All driving functions
 * 
 * Stick_drive for one joystick driving
 * Drive method that runs drive motors.
/*----------------------------------------------------------------------------*/

package logomotion_2011;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Jaguar;

public class Drive_Controls {
    
    //Jaqs 
    public static Jaguar left  = new Jaguar(1);
    public static Jaguar right = new Jaguar(2);
    //Time
    public static Timer Timer;
    
    /***************************************************************************
    * Driving function based off joy stick commands 
    * Speed range from -1 to 1
    ***************************************************************************/
    public static void Telop_Stick_Drive() {
        double x_dead = .07; //Deadpan limits
        double y_dead = .07; //Deadpan limits
        double x = Joysticks.joystick1.getX();
        double y = Joysticks.joystick1.getY();
        //Deadband
        if (Math.abs(x) < x_dead) 
            x = 0;
        if(Math.abs(y) < y_dead ) 
            y = 0;
        double l= (x+y);
        double r= (x-y);

        Drive(l,r); //Calls the drive method to input the speeds for the MCs
    } 
    
    /***************************************************************************
    * Method to run motor controllers 
    * One double for the left MC one for right MC
    ***************************************************************************/
    public static void Drive(double left_input, double right_input) {
        left.set(left_input);
        right.set(right_input);
    }
    
    public static void Stop() {
        Drive(0,0);
    }

}